package com.pengtu.gsj.entity.yh;

import java.util.List;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.JoinColumn;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.persistence.Transient;

import com.pengtu.gsj.entity.app.Attachment;
import com.pengtu.gsj.entity.base.IdEntity;

/**
 * 
 * 
 * MainBulletin
 * 养护工作通报记录
 * 2017年6月1日 上午11:17:55
 * @author lei
 * @version 1.0.0
 *
 */
@Entity
@Table(name = "T_YH_MAINBULLETIN")
public class MainBulletin extends IdEntity{
	
	private static final long serialVersionUID = 1L;
	
	private String bullentinYear;
	
	private String remark;
	
	private String manageOrg;
	
	private Integer bulletinNumber;   //通报和整改文件数
	
	private List<Attachment> attachments;
	
	
	public MainBulletin(){
		
	}
	
	public MainBulletin(String manageOrg) {
		this.manageOrg = manageOrg;
	}

	@Column(name = "BULLENTINYEAR")
	public String getBullentinYear() {
		return bullentinYear;
	}

	public void setBullentinYear(String bullentinYear) {
		this.bullentinYear = bullentinYear;
	}
	
	@Column(name = "REMARK")
	public String getRemark() {
		return remark;
	}

	public void setRemark(String remark) {
		this.remark = remark;
	}

	 @Column(name = "MANAGEORG")
	public String getManageOrg() {
		return manageOrg;
	}

	public void setManageOrg(String manageOrg) {
		this.manageOrg = manageOrg;
	}

	@Transient
	public Integer getBulletinNumber() {
		bulletinNumber = getAttachments().size();
		return bulletinNumber;
	}

	public void setBulletinNumber(Integer bulletinNumber) {
		this.bulletinNumber = bulletinNumber;
	}

	@OneToMany(fetch = FetchType.LAZY)
	@JoinColumn(name = "PARTID")
	public List<Attachment> getAttachments() {
		return attachments;
	}

	public void setAttachments(List<Attachment> attachments) {
		this.attachments = attachments;
	}
	
	
	

}
